<%@page import="poggy.lightapp.entity.po.Menu"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!-- 顶部内容 -->
<header class="main-header">
	<!-- Logo -->
	<a href="index.html" class="logo"> <!-- mini logo for sidebar mini 50x50 pixels -->
		<span class="logo-mini"><b>宇视</b></span> <!-- logo for regular state and mobile devices -->
		<span class="logo-lg "><img class="minilogo"
			src="${basePath}/static/adminLTE/img/uniview-logo.png" /></span>
	</a>
	<!-- Header Navbar: style can be found in header.less -->
	<nav class="navbar navbar-static-top">
		<!-- Sidebar toggle button-->
		<a href="#" class="sidebar-toggle" data-toggle="offcanvas"
			role="button"> <span class="sr-only">Toggle navigation</span> <span
			class="icon-bar"></span> <span class="icon-bar"></span> <span
			class="icon-bar"></span>
		</a>

		<div class="navbar-custom-menu">
			<ul class="nav navbar-nav">
				<!-- User Account: style can be found in dropdown.less -->
				<li class="dropdown user user-menu"><a href="#"
					class="dropdown-toggle" data-toggle="dropdown"> <img
						src="${basePath}/static/adminLTE/img/user2-160x160.jpg"
						class="user-image" alt="User Image"> <span class="hidden-xs">${empName}</span>
				</a>
					<ul class="dropdown-menu">
						<!-- User image -->
						<li class="user-header"><img
							src="${basePath}/static/adminLTE/img/user2-160x160.jpg"
							class="img-circle" alt="User Image">

							<p>
								${empName} - ${position } <small>工号 ${empCode }</small>
							</p></li>
						<!-- Menu Footer-->
						<li class="user-footer">
							<div class="pull-left">
								<a href="#" class="btn btn-default btn-flat">个人信息</a>
							</div>
							<div class="pull-right">
								<a href="${basePath}/LoginOut" class="btn btn-default btn-flat">退出登录</a>
							</div>
						</li>
					</ul></li>
			</ul>
		</div>
	</nav>
</header>

<!-- =============================================== -->

<!-- 左边菜单 sidebar -->
<aside class="main-sidebar">
	<!-- sidebar: style can be found in sidebar.less -->
	<section class="sidebar">
		<!-- Sidebar user panel -->
		<div class="user-panel">
			<div class="pull-left image">
				<img src="${basePath}/static/adminLTE/img/user2-160x160.jpg"
					class="img-circle" alt="User Image">
			</div>
			<div class="pull-left info">
				<p>${empName }</p>
				<a href="#"><i class="fa fa-circle text-success"></i> 在线</a>
			</div>
		</div>
		<!-- search form -->
		<form action="#" method="get" class="sidebar-form">
			<div class="input-group">
				<input type="text" name="q" class="form-control"
					placeholder="输入菜单名称查找..."> <span class="input-group-btn">
					<button type="submit" name="search" id="search-btn"
						class="btn btn-flat">
						<i class="fa fa-search"></i>
					</button>
				</span>
			</div>
		</form>
		<ul class="sidebar-menu">
			<li class="header">系统菜单</li>
			<li class="treeview"><a href="#"> <i class="fa fa-dashboard"></i>
					<span>首页</span> <span class="pull-right-container"> </span>
			</a></li>
		</ul>
	</section>
	<!-- /.sidebar -->
</aside>

<script type="text/javascript">
	var menusStr = '${menusList}'
	var menusList = JSON.parse(menusStr);
	var menuhtml = '';
	for(var i=0;i<menusList.length;i++){
		menuhtml +='<li class="treeview"><a href="javascrpit:void(0)"> <i class="fa '+menusList[i].menuIcon+'"></i>';
		menuhtml +='<span>'+menusList[i].menuName+'</span> <span class="pull-right-container"> <span';
		menuhtml +=' class="fa fa-angle-left pull-right"></span></a>';
		var children = menusList[i].childrenMenus;
		
		if(children && children.length >0){
			 menuhtml +='<ul class="treeview-menu">';
			 for(var j=0;j<children.length;j++){
				menuhtml += '<li data-url="${basePath}'+children[j].menuUrl+'"><a href="javascrpit:void(0)"><i';
				menuhtml += ' class="fa '+children[j].menuIcon+'"></i> '+children[j].menuName+'</a></li>';
			} 
			menuhtml += '</ul>';
		} 
		menuhtml += '</li>';
	}
	$('.sidebar-menu').append(menuhtml);
</script>

